//
//  EMMNewDecisionViewController.m
//  EMMApp
//
//  Created by Mac on 16/7/4.
//  Copyright © 2016年 YiXun. All rights reserved.
//

#import "EMMNewDecisionViewController.h"
/** ViewController
 *
 *  首页ViewController导入.h文件
 */
#import "DealPropertyTypeAnalysisViewController.h"  //成交房产类型分析
#import "WorkloadStatisticsViewController.h"        //工作量统计
#import "StockTimeAnalysisViewController.h"         //存量时间分析
#import "StockAvailabilityViewController.h"         //存量房源分析
#import "EMMNotSignedBackViewController.h"          //签约未回款
#import "EMMSalesTargetViewController.h"            //销售指标
#import "CalculationPAViewController.h"             //算价
#import "EMMAnalysisViewController.h"               //客户分析
#import "ProjectModel.h"                            //项目对象

/** Cell
 *
 *  首页Cell导入.h文件
 */
#import "DecisionOneCellColl.h"
#import "EMMNewDecisionCell.h"
#import "NewCustomersCell.h"
#import "DecisionOneCell.h"
#import "MarketingCell.h"

/** Api
 *
 *  首页Api调用导入.h文件
 */
#import "GetMemberScoreListApi.h"


@interface EMMNewDecisionViewController ()<UITableViewDelegate,UITableViewDataSource,UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
{
    NSString *timer;
    NSString *tierXZA;
    //判断导航
    BOOL _isShowUI;
    UITableView *_tableView;
    NSMutableDictionary *dic;//存对应的数据
    NSMutableArray *selectedArr;//二级列表是否展开状态
    NSMutableArray *grouparr;
}
@property (nonatomic, strong) NSString *rcScoreNum;
@property (nonatomic, strong) NSString *rgScoreNum;
@property (nonatomic, strong) NSString *qyScoreNum;

@property (nonatomic, strong) MenuLitsView *menuD;//导航
@property (nonatomic, strong) NSMutableArray *menuListD;//导航数组
@property (nonatomic, strong) NSMutableArray *menuArrD;//导航数组
@property (nonatomic, strong) UICollectionView *homeCollectionView;
@property (nonatomic, strong) GetMemberScoreList *getMemberScoreList;
@end

@implementation EMMNewDecisionViewController

#pragma mark - 初始化
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorFromHexCode:@"#f7f7f7"];
    selectedArr = [NSMutableArray arrayWithObjects:@"2", nil];
    grouparr = [NSMutableArray arrayWithObjects:@"成交房产类型分析",@"存量时间分析",@"成交房源分析",@"存量房源分析",@"算价分析", nil];
    
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, EMM_WIDTH,EMM_HEIGHT-SafeAreaTopHeight-SafeAreaBottomHeight) style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.showsVerticalScrollIndicator = NO;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:_tableView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - 生命周期函数调用方法
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    timer = @"1";
    _menuListD = [[NSMutableArray alloc] init];
    _menuArrD = [[NSMutableArray alloc] init];
    [self postGetProjectListApi];
    [self creatNavigationController];
    timer = @"1";
    tierXZA = @"今天";
    [self PostGetMemberScoreListApiTimeType:timer];
}

#pragma mark - 切换项目IAP
- (void)postGetProjectListApi {
    [_menuListD removeAllObjects];
    [_menuArrD removeAllObjects];
    NSUserDefaults *us = [NSUserDefaults standardUserDefaults];
    NSMutableArray *projectDataArray = [us objectForKey:@"projectArray"];
    if (projectDataArray.count > 0 ) {
        NSMutableArray *arr = [[NSMutableArray alloc] init];
        for (int i = 0; i < projectDataArray.count; i++) {
            NSData *data = projectDataArray[i];
            ProjectModel *model = [NSKeyedUnarchiver unarchiveObjectWithData:data];
            [_menuListD addObject:model.projectName];
            ProjectList *lsit = [[ProjectList alloc] init];
            lsit.projectName = model.projectName;
            lsit.projectId = model.projectId;
            lsit.projectCode = model.projectCode;
            [_menuArrD addObject:lsit];
            [arr addObject:lsit.projectCode];
        }
        NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
        NSString *projectCode = [userdf objectForKey:@"projectCode"];
        for (int i = 0; i < arr.count; i++) {
            NSString *pro = [arr objectAtIndex:i];
            if ([pro isEqualToString:projectCode]) {
                [userdf setObject:[NSString stringWithFormat:@"%d",i] forKey:@"indexString"];
                [userdf synchronize];
            }else {
            }
        }
    }
}

#pragma mark - 导航
- (void)creatNavigationController {
    [self updateNavBar];
    NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
    NSString *token = [userdf objectForKey:@"is_login"];
    NSString *projectName;
    if ([NSString isStringEmpty2:token] == NO) {
        projectName  = [userdf objectForKey:@"projectName"];
    }
    NavigationView *view = [[NavigationView alloc] initWithFrame:CGRectMake(0, 0, EMM_WIDTH/2, 44) title:projectName colo:@"2"];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    [button addTarget:self action:@selector(showPopover:) forControlEvents:UIControlEventTouchUpInside];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    button.frame = CGRectMake(0, 0, view.frame.size.width, 44.0);
    button.titleLabel.font = [UIFont systemFontOfSize:16];
    button.tag = 101;
    button.titleLabel.textAlignment = NSTextAlignmentCenter;
    button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    [view addSubview:button];
    [self.navigationItem setTitleView:view];
}

#pragma mark - 显示app商家列表
- (void)showPopover:(UIButton *)button {
    if (_isShowUI == YES) {
        [self removeMenuLitsViewSubView];
        [self creatView];
        _isShowUI = NO;
    }else {
        [self removeMenuLitsViewSubView];
        _isShowUI = YES;
    }
}

#pragma mark - 创建项目切换View
- (void)creatView {
    NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
    NSString *num = [userdf objectForKey:@"indexString"];
    NSInteger h = 0;
    if (_menuListD.count > 6) {
        h = 6*50;
    }else {
        h = _menuListD.count * 50;
    }
    _menuD = [[MenuLitsView alloc] initWithFrame:CGRectMake(0, SafeAreaTopHeight, EMM_WIDTH, EMM_HEIGHT-SafeAreaTopHeight) items:_menuListD indet:num isShowUI:YES guodu:h];
    _menuD.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    [[UIApplication sharedApplication].keyWindow addSubview:_menuD];
    __weak MenuLitsView *weakSelf = _menuD;
    [weakSelf setMenuLitsBlock:^(NSString *title, NSString *indet) {
        if ([NSString isStringEmpty2:title] == NO) {
            _isShowUI = YES;
        }else {
            _isShowUI = YES;
        }
        if ([NSString isStringEmpty2:indet] == NO) {
            ProjectList *lsit1 = _menuArrD[[indet intValue]];
            NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
            [userdf setObject:lsit1.projectCode forKey:@"projectCode"];
            [userdf setObject:lsit1.projectId forKey:@"projectId"];
            [userdf setObject:lsit1.projectName forKey:@"projectName"];
            [userdf setObject:indet forKey:@"indexString"];
            [userdf synchronize];
            [self creatNavigationController];
            [self PostGetMemberScoreListApiTimeType:timer];
        }
        [weakSelf removeFromSuperview];
    }];
}

#pragma mark - 删除项目切换View
- (void)removeMenuLitsViewSubView {
    [_menuD removeFromSuperview];
    _menuD = nil;
}

#pragma mark - 时间选择弹出View
- (void)decisionBtnClick:(UIButton *)btn {
    NSArray *arr = [NSArray arrayWithObjects:
                    @"今天",@"昨天",@"本周",
                    @"上周",@"本月",@"上月",@"近三月",@"今年", nil];
    ShowMenuView *menuView = [[ShowMenuView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) title:@"选项" titleNmae:@"选择时间" numLits:nil items:arr];
    menuView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    [[UIApplication sharedApplication].keyWindow addSubview:menuView];
    __block ShowMenuView *weakMenuView = menuView;//
    __block EMMNewDecisionViewController *blockSelf = self;
    [menuView setTouchBlock:^(NSString *indet,NSString *number) {
        NSLog(@"%@",indet);
        if ([NSString isStringEmpty2:indet] == NO) {
            tierXZA = indet;
            timer = number;
            
            [blockSelf PostGetMemberScoreListApiTimeType:timer];
        }
        [weakMenuView removeFromSuperview];
        [_tableView reloadData];
    }];
}

#pragma mark - 查询会员成绩信息Api调用方法
- (void)PostGetMemberScoreListApiTimeType:(NSString *)timeType {
    NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
    NSString *projectCode = [userdf objectForKey:@"projectCode"];
//    [self showHud:@"正在加载请稍等..."];
     [self showHudInWindow:@"正在加载请稍等..."];
    GetMemberScoreListApi *api = [[GetMemberScoreListApi alloc] initWithProjectCode:projectCode timeType:timeType scoreCategory:@"2"];
    [api startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) {
        GetMemberScoreListApi *result = (GetMemberScoreListApi *)request;
        if (result.isSuccess) {
            GetMemberScoreList *get = result.resultData;
            _getMemberScoreList = get;
        } else {
            NSUserDefaults *userdf = [NSUserDefaults standardUserDefaults];
            NSString *projectCode = [userdf objectForKey:@"projectCode"];
            if ([NSString isStringEmpty2:projectCode] == NO) {
                [self showToast:result.resultData.errorMsg];
            }
            
            /*
             提示语：账号权限发生变动，请重新登录
             code随机18位唯一码：108E65843mYuwqb01X
             //YUplf0wyU5vPVssLSG 对应的异地登录退出登录
             */
            if ([result.resultData.errorCode isEqualToString:@"YUplf0wyU5vPVssLSG"]) {
                NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
                NSDictionary *dictionary = [defs dictionaryRepresentation];
                for(NSString *key in [dictionary allKeys]){
                    if ([key isEqualToString:@"DeviceToken123"] ||
                        [key isEqualToString:@"loginText"] ||
                        [key isEqualToString:@"provinceCityDistrict"]) {
                    }else {
                        [defs removeObjectForKey:key];
                        [defs synchronize];
                    }
                }
                [appInstance showLogin];
                
            } else if ( [result.resultData.errorCode isEqualToString:@"108E65843mYuwqb01X"]) {
                NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
                NSDictionary *dictionary = [defs dictionaryRepresentation];
                for(NSString *key in [dictionary allKeys]){
                    if ([key isEqualToString:@"DeviceToken123"] ||
                        [key isEqualToString:@"loginText"] ||
                        [key isEqualToString:@"provinceCityDistrict"]) {
                    }else {
                        [defs removeObjectForKey:key];
                        [defs synchronize];
                    }
                }
                UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:result.resultData.errorMsg preferredStyle:UIAlertControllerStyleAlert];
                UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                    [appInstance showLogin];
                }];
                [alertController addAction:cancelAction];
                [self presentViewController:alertController animated:YES completion:nil];
            }
        }
        [_tableView reloadData];
        [self hideHud];
    } failure:^(YTKBaseRequest *request) {
        [self showToast:@"连接服务器失败，请检查网络！"];
        [self hideHud];
    }];
}

#pragma mark----tableViewDelegate
//返回几个表头
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 3;
}

//每一个表头下返回几行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    NSString *string = [NSString stringWithFormat:@"%ld",section];
    if (section == 2) {
        if ([selectedArr containsObject:string]) {
            return grouparr.count;
        }else {
            return 0;
        }
    }
    return 1;
}

//设置表头的高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    if (section == 2) {
        return 50;
    }
    return 0;
}

//Section Footer的高度
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0;
}

//设置view，将替代titleForHeaderInSection方法
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, EMM_WIDTH, 50)];
    view.backgroundColor = [UIColor colorFromHexCode:@"#fff5e9"];
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, EMM_WIDTH, 50)];
    [view addSubview:titleLabel];
    titleLabel.text = @"房源分析";
    titleLabel.font = [UIFont systemFontOfSize:15];
    titleLabel.textColor = [UIColor colorFromHexCode:@"#1A1A1A"];
    UILabel *sLabel6 = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, 4, 30)];
    sLabel6.backgroundColor = [UIColor colorFromHexCode:@"#ffa626"];
    [view addSubview:sLabel6];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, 0, EMM_WIDTH, 50);
    button.tag = 100+section;
//    [button addTarget:self action:@selector(doButton:) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:button];
    UIImageView *upImageView = [[UIImageView alloc] initWithFrame:CGRectMake(EMM_WIDTH-40, 15, 25, 15)];
//    [view addSubview:upImageView];
    NSString *string = [NSString stringWithFormat:@"%ld",section];
    if ([selectedArr containsObject:string]) {
        upImageView.image = [UIImage imageNamed:@"sanjt_down"];
    }else {
        upImageView.image = [UIImage imageNamed:@"sanjt_up"];
    }
    if (section == 2) {
        return view;
    }
    return nil;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        return 230;
    }else if (indexPath.section == 1) {
        return 75;
    }
    return 50;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"MarketingCell";
    MarketingCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"MarketingCell" owner:self options:nil] lastObject];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if (indexPath.section == 0) {
        static NSString *CellIdentifier = @"DecisionOneCell";
        DecisionOneCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            cell = [[[NSBundle mainBundle] loadNibNamed:@"DecisionOneCell" owner:self options:nil] lastObject];
        }
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        [cell.decisionBtn addTarget:self action:@selector(decisionBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        cell.titleNameLabel.text = tierXZA;
        if ([NSString isStringEmpty2:_getMemberScoreList.rcScoreNum] == NO) {
            cell.rcNumLabel.text = _getMemberScoreList.rcScoreNum;
        }else {
            cell.rcNumLabel.text = @"0";
        }
        
        if ([NSString isStringEmpty2:_getMemberScoreList.qyScoreNum] == NO) {
            cell.qyNumLabel.text = _getMemberScoreList.qyScoreNum;
        }else {
            cell.qyNumLabel.text = @"0";
        }
        
        if ([NSString isStringEmpty2:_getMemberScoreList.rgScoreNum] == NO) {
            cell.rgNumLabel.text = _getMemberScoreList.rgScoreNum;
        }else {
            cell.rgNumLabel.text = @"0";
        }
        
        if ([NSString isStringEmpty2:_getMemberScoreList.returnAmount] == NO) {
            cell.hkNumLabel.text = _getMemberScoreList.returnAmount;
        }else {
            cell.hkNumLabel.text = @"0";
        }
        
        if ([NSString isStringEmpty2:_getMemberScoreList.signedAmount] == NO) {
            cell.qyjeLabel.text = _getMemberScoreList.signedAmount;
        }else {
            cell.qyjeLabel.text = @"0";
        }
        
        if ([NSString isStringEmpty2:_getMemberScoreList.subscribeAmount] == NO) {
            cell.rgjeLabel.text = _getMemberScoreList.subscribeAmount;
        }else {
            cell.rgjeLabel.text = @"0";
        }
        return cell;
    }else if (indexPath.section == 1) {
        
        [self creatCollectionView];
        [cell addSubview:self.homeCollectionView];
        [_homeCollectionView reloadData];
       
    }else {
        static NSString *CellIdentifier = @"EMMNewDecisionCellId";
        EMMNewDecisionCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            cell = [[[NSBundle mainBundle] loadNibNamed:@"EMMNewDecisionCell" owner:self options:nil] lastObject];
        }
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.nameL.text = [grouparr objectAtIndex:indexPath.row];
        cell.nameL.font = [UIFont systemFontOfSize:15];
        cell.nameL.textColor = [UIColor colorFromHexCode:@"#5A5A5A"];
        UIImageView *lineImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 49.5, EMM_WIDTH-20, 0.5)];
        lineImage.backgroundColor = [UIColor colorFromHexCode:@"#CCCCCC"];
        [cell addSubview:lineImage];
        return cell;
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 2) {
        if (indexPath.row == 0) {
            DealPropertyTypeAnalysisViewController *evc = [[DealPropertyTypeAnalysisViewController alloc] init];
            evc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:evc animated:YES];
        }else if (indexPath.row == 1) {
            StockTimeAnalysisViewController *evc = [[StockTimeAnalysisViewController alloc] init];
            evc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:evc animated:YES];
        }else if (indexPath.row == 2) {
            StockAvailabilityViewController *evc = [[StockAvailabilityViewController alloc] init];
            evc.hidesBottomBarWhenPushed = YES;
            evc.isStock = NO;
            [self.navigationController pushViewController:evc animated:YES];
        }else if (indexPath.row == 3) {
            StockAvailabilityViewController *evc = [[StockAvailabilityViewController alloc] init];
            evc.hidesBottomBarWhenPushed = YES;
            evc.isStock = YES;
            [self.navigationController pushViewController:evc animated:YES];
        }else if (indexPath.row == 4) {
            CalculationPAViewController *evc = [[CalculationPAViewController alloc] init];
            evc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:evc animated:YES];
        }
    }
}


#pragma mark - UICollectionView初始化
- (void)creatCollectionView {
    UICollectionViewFlowLayout *layuet = [[UICollectionViewFlowLayout alloc] init];
    //垂直行间距
    layuet.minimumLineSpacing = 0;
    //水平间隔
    layuet.minimumInteritemSpacing = 0;
    [layuet setScrollDirection:UICollectionViewScrollDirectionVertical];
    self.homeCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, EMM_WIDTH, 75) collectionViewLayout:layuet];
    [self.homeCollectionView registerNib:[UINib nibWithNibName:@"DecisionOneCellColl" bundle:nil] forCellWithReuseIdentifier:@"DecisionOneCellColl"];
    self.homeCollectionView.delegate = self;
    self.homeCollectionView.dataSource = self;
    self.homeCollectionView.backgroundColor = [UIColor colorFromHexCode:@"f6fafb"];
    self.homeCollectionView.scrollEnabled = NO;
    
}

#pragma mark - UICollectionViewDataSource / UICollectionViewDelegate /UICollectionViewDelegateFlowLayout 代理
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    
    return 4;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellId = @"DecisionOneCellColl";
    DecisionOneCellColl *homeCell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];
    homeCell.backgroundColor = [UIColor colorFromHexCode:@"f6fafb"];
    if (indexPath.row == 0) {
        homeCell.nameLabel.text = @"客户分析";
        homeCell.decImV.image = [UIImage imageNamed:@"fx_kh"];
    }else if (indexPath.row == 1) {
        homeCell.nameLabel.text = @"已签约未回款";
        homeCell.decImV.image = [UIImage imageNamed:@"fx_ico6"];
    }else if (indexPath.row == 2) {
        homeCell.nameLabel.text = @"工作量统计";
        homeCell.decImV.image = [UIImage imageNamed:@"fx_ico7"];
    }else if (indexPath.row == 3) {
        homeCell.nameLabel.text = @"销售指标";
        homeCell.decImV.image = [UIImage imageNamed:@"fx_gzl"];
        homeCell.decL.hidden = YES;
    }
    return homeCell;
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    return CGSizeMake((EMM_WIDTH)/4, 75);
}

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
    return UIEdgeInsetsMake(0, 0, 0, 0);
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        EMMAnalysisViewController *evc = [[EMMAnalysisViewController alloc] init];
        evc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:evc animated:YES];
    } else if (indexPath.row == 1) {
        EMMNotSignedBackViewController *evc = [[EMMNotSignedBackViewController alloc] init];
        evc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:evc animated:YES];
    } else if (indexPath.row == 2) {
        WorkloadStatisticsViewController *evc = [[WorkloadStatisticsViewController alloc] init];
        evc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:evc animated:YES];
    } else if (indexPath.row == 3) {
        EMMSalesTargetViewController *evc = [[EMMSalesTargetViewController alloc] init];
        evc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:evc animated:YES];
    }
}

@end
